<?php

namespace App\Http\Requests\UserApi;

use App\Http\Requests\BaseRequest;
use Illuminate\Foundation\Http\FormRequest;

class SubscribeRequest extends BaseRequest
{
    protected $rules = [

    ];

    //这里我只写了部分字段，可以定义全部字段
    protected $strings_key = [
        'class_id' => '課程ID',
        'store_id' => '門店ID',
        'class_classroom_id' => '課室ID',
        'class_base_info_id' => '課室安排ID',
        'subscribe_time' => '预约日期',
    ];

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $function = request()->route()->getAction();
        $rules = $this->rules;

        // 根据不同的情况, 添加不同的验证规则
        if ($function['controller'] == 'App\Http\Controllers\UserApi\UserSubscribeController@create_subscribe')
        {
            $rules=[
                //'class_id'=>'required|exists:class_base,id',
                //'store_id'=>'required|exists:stores,id',
                //'class_classroom_id'=>'required|exists:classroom,id',
                'class_base_info_id'=>'required|exists:class_base_info,id',
                'subscribe_time'=>'required',
            ];
        }


        return $rules;
    }
}
